

import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_bsbdj/utils/shared_preferences_util.dart';

class Constant{

  static String USER_INFO="user_info";

  static String USER_ID="user_id";

  static String USER_NAME="user_name";

  static String USER_PIC="pic";

  static String IMAGE_USER_HANDER="images/user_header.jpg";

  static String IMAGE_HEADER_BG="images/ic_header_bg.jpg";

  static String IMAGE_LOADING="images/ic_loading.gif";

  static String IMAGE_ZHIHU="images/ic_zhihu.png";

  static String IMAGE_THEME_DARK="images/theme_dark.png";

  static String IMAGE_THEME_DAY="images/theme_day.png";

  static String LOGIN_OUT="login_out";

  static String THEME="theme_day";

  static Constant _constant;

  bool _themeDay=true;

  static Constant getInstance(){
    if(_constant==null){
      _constant=new Constant();
    }
    return _constant;
  }

  bool changeTheme(){
    _themeDay=!_themeDay;
    SharedPrefrenceUtil.setBoolValue(THEME, _themeDay);
    return _themeDay;
  }

  bool getTheme(){
    return _themeDay;
  }

  Color getItemColor(){
    return _themeDay?Colors.white:Colors.black38;
  }

  Future<bool> initTheme()async{
    bool value=await SharedPrefrenceUtil.getBoolValue(THEME, _themeDay);
    _themeDay=value;
    return _themeDay;
  }

}

